package com.singleton;

/******
 * 懒汉式
 */
public class Singleton {
	// 当需要的才会被实例化
	private static Singleton singleton;
	private Singleton() {
	}
	synchronized public static Singleton getSingleton() {
		if (singleton == null) {
			singleton = new Singleton();
		}
		return singleton;
	}
	
}

